﻿@page "/auditing"

@attribute [ReuseTabsPage(Title = "审计日志")]
@inherits BaseComponent
@attribute [Authorize(PermissionNames.AdministratorBaseInfoPost)]
@using ZLJ.Application.Share.Auditing

<Flex Gap="small" Vertical Justify="space-between">

     <Flex Gap="small" Justify="flex-end">
         @*
        0.17.3.1 andblazor 的 ChangeOnClose 属性会导致DatePicker很卡，且清空按钮不正常
        清空时OnChang会触发两次，与ChangeOnClose无关
        *@
         <DatePicker TValue="DateTime?" @bind-Value="condition.StartDate" Placeholder=@("开始时间") ShowTime=true OnClear="Search" OnOk="Search" Disabled=isLoading AllowClear=true></DatePicker>
         <DatePicker TValue="DateTime?" @bind-Value="condition.EndDate" Placeholder=@("结束时间") ShowTime=true OnClear="Search" OnOk="Search" Disabled=isLoading AllowClear=true></DatePicker>
         @* Search组件有问题，设置宽度会错位 *@
         <div style="width:15rem;">
             <Search Placeholder="请输入关键字..." @bind-Value="condition.Keywords" OnChange=Search AllowClear="true" ClassicSearchIcon="true" Disabled=isLoading />
         </div>
         <Tooltip Title="清空条件">
             <Button Type="@ButtonType.Default" Icon="@IconType.Outline.Clear" OnClick="BtnReLoadClick" Disabled=isLoading></Button>
         </Tooltip>
     </Flex>

     <Table @ref="table"
            TItem="AuditLogListDto"
            OnChange="OnChange"
            RemoteDataSource="true"
            Loading=isLoading
            DataSource="data"
            Size="TableSize.Small"
            Total="total"
            RowClassName="@(r=>r.RowIndex%2==0?"even":"odd")"
            ScrollX="2300"
            ScrollY="71.5vh"
           Bordered
            RowKey="x=>x.Id">

         <Selection Key="@(context.Id.ToString())" Width="50" />
         <PropertyColumn Property="c=>c.ExecutionTime" Sortable Width="180" />
         <PropertyColumn Property="c=>c.ExecutionDuration" Sortable Width="100" />

         <PropertyColumn Property="c=>c.UserName" Sortable Width="200" />
         @* <PropertyColumn Property="c=>c.ClientName" Width="200" /> *@
         <PropertyColumn Property="c=>c.ClientIpAddress" Width="150" />
         <PropertyColumn Property="c=>c.ServiceName" Sortable Width="250" />
         <PropertyColumn Property="c=>c.MethodName" Sortable Width="250" />
         <PropertyColumn Property="c=>c.Parameters" />
         <PropertyColumn Property="c=>c.Exception" />
         <PropertyColumn Property="c=>c.BrowserInfo" />
     </Table>

 </Flex>